local skels = {}

local tiaoxin = fk.CreateSkill{
    name = "xiaobai__tiaoxin",
}
Fk:loadTranslationTable{
    ["xiaobai__tiaoxin"] = "挑衅",
    [":xiaobai__tiaoxin"] = "出牌阶段限一次，你可以指定一名你在其攻击范围内的角色，然后除非其对你使用一张【杀】，否则你弃置其一张牌。",

    ["#xiaobai__tiaoxin"] = "挑衅：令一名角色对你使用一张【杀】，否则你弃置其一张牌",
    ["#xiaobai__tiaoxin-use"] = "挑衅：对 %src 使用一张【杀】，否则其弃置你一张牌",
}
tiaoxin:addEffect("active", {
    anim_type = "control",
    max_phase_use_time = 1,
    card_num = 0,
    target_num = 1,
    can_use = function(self, player)
        return player:usedSkillTimes(tiaoxin.name, Player.HistoryPhase) == 0
    end,
    card_filter = Util.FalseFunc,
    target_filter = function(self, player, to_select, selected)
        return #selected == 0 and to_select:inMyAttackRange(player)
    end,
    on_use = function(self, room, effect)
        local player = effect.from
        local target = effect.tos[1]
        local use = room:askToUseCard(target, {
            skill_name = tiaoxin.name,
            pattern = "slash",
            prompt = "#xiaobai__tiaoxin-use:"..player.id,
            extra_data = {
                exclusive_targets = {player.id},
                bypass_times = true,
            }
        })
        if use then
            use.extraUse = true
            room:useCard(use)
        else
            if not target:isNude() then
                local card = room:askToChooseCard(player, {
                target = target,
                skill_name = tiaoxin.name,
                flag = "he",
                })
                room:throwCard(card, tiaoxin.name, target, player)
            end
        end
    end,
})
table.insert(skels,tiaoxin)

local xiaohuang = fk.CreateSkill{
    name = "xiaobai__xiaohuang",
}
Fk:loadTranslationTable{
    ["xiaobai__xiaohuang"] = "嚣獚",
    [":xiaobai__xiaohuang"] = "出牌阶段限一次或当你造成伤害后，你可以对一名手牌数大于体力值的其他角色发动“挑衅”。若其因此使用【杀】，你下一次发动“严教”时额外亮出一张牌。",
    ["#xiaobai__xiaohuang"] = "嚣獚：是否对一名手牌数大于体力值的其他角色发动“挑衅”",
}
xiaohuang:addEffect("active", {
    prompt = "#xiaobai__xiaohuang",
    anim_type = "control",
    max_phase_use_time = 1,
    card_num = 0,
    target_num = 1,
    can_use = function(self, player)
        return player:usedSkillTimes(xiaohuang.name, Player.HistoryPhase) == 0
    end,
    card_filter = Util.FalseFunc,
    target_filter = function(self, player, to_select, selected)
        return #selected == 0 and to_select:getHandcardNum() > to_select.hp and to_select ~= player
    end,
    on_use = function(self, room, effect)
        local player = effect.from
        local target = effect.tos[1]
        room:notifySkillInvoked(player,"xiaobai__tiaoxin","control")
        local use = room:askToUseCard(target, {
            skill_name = tiaoxin.name,
            pattern = "slash",
            prompt = "#xiaobai__tiaoxin-use:"..player.id,
            extra_data = {
                exclusive_targets = {player.id},
                bypass_times = true,
            }
        })
        if use then
            use.extraUse = true
            room:useCard(use)
            room:addPlayerMark(player, "@yanjiao", 1)
        else
            if not target:isNude() then
                local num = 1 + player:getMark("@xiaobai__tiaoxin")
                local card = target:getCardIds("he")
                if #card > num then
                    card = room:askToChooseCards(player, {
                        max = num,
                        min = num,
                        target = target,
                        skill_name = tiaoxin.name,
                        flag = "he",
                    })
                end
                room:throwCard(card, tiaoxin.name, target, player)
            end
        end
    end,
})
xiaohuang:addEffect(fk.Damage,{
    can_refresh = function (self, event, target, player, data)
        return target == player and player:hasSkill(xiaohuang.name)
    end,
    on_refresh = function (self, event, target, player, data)
        player.room:askToUseActiveSkill(player,{
            skill_name = xiaohuang.name,
            prompt = "#xiaobai__xiaohuang",
        })
    end,
})
table.insert(skels,xiaohuang)

return skels